package com.tk.exam.service.impl;

import com.github.pagehelper.PageInfo;
import com.tk.exam.dao.TkQuesCategoryDao;
import com.tk.exam.domain.TkQuestionCategory;
import com.tk.exam.domain.TkQuestionCategoryExample;
import com.tk.exam.mapper.TkQuestionCategoryMapper;
import com.tk.exam.service.TkQuesCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Slf4j
public class TkQuestCategoryServiceImpl implements TkQuesCategoryService {
    @Autowired
    private TkQuesCategoryDao tkQuesCategoryDao;
    @Autowired
    private TkQuestionCategoryMapper tkQuesCategoryMapper;

    @Override
    public PageInfo<TkQuestionCategory> searchList() {
        return tkQuesCategoryDao.selectQuesCategoryWithPage();
    }

    @Override
    public List<TkQuestionCategory> searchListNoPage() {
        TkQuestionCategoryExample example = new TkQuestionCategoryExample();
        return tkQuesCategoryMapper.selectByExample(example);
    }

    @Override
    @Transactional
    public TkQuestionCategory save(TkQuestionCategory tkQuestionCategory) {
        return tkQuesCategoryDao.save(tkQuestionCategory);
    }

    @Override
    public TkQuestionCategory edit(String id) {
        return null;
    }

    @Override
    public TkQuestionCategory findById(String id) {
        return tkQuesCategoryDao.findById(id);
    }
}